package com.ssish.saas.eccs.mapper;

import com.ssish.saas.eccs.model.Corporate;
import com.ssish.saas.eccs.model.CorporateExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface CorporateMapper {
    long countByExample(CorporateExample example);

    int deleteByExample(CorporateExample example);

    @Delete({
        "delete from CORPORATE",
        "where CORP_CODE = #{corpCode,jdbcType=VARCHAR}"
    })
    int deleteByPrimaryKey(String corpCode);

    @Insert({
        "insert into CORPORATE (CORP_CODE, SHORT_NAME, ",
        "LONG_NAME, ADDRESS, POSTCODE, ",
        "CITY, STATE, COUNTRY, ",
        "TEL_NO, FAX_NO, CONTACT_PERSON, ",
        "CORP_TYPE, EMAIL, ",
        "PAYOR_CODE, EDI_ADDRESS, ",
        "EDI_CLAIMS, PRINT_CHIT, ",
        "COMM_CODE, INVOICE_FORMAT, ",
        "INVOICE_CYCLE, CUTOFF_DATE, ",
        "ACTIVE_FLAG, LASTEDIT_DATE, ",
        "USER_CODE, CORP_INVST, ",
        "CORP_UTILZ_P, CORP_DIS_UTILZ_P, ",
        "DBCD, RENEWAL_MODE, ",
        "ACTIVATION_DATE, CANCELLATION_DATE, ",
        "SERVICE_FEE, CARD_FEE, ",
        "FEE_QUANTUM, REMARKS, ",
        "SERVICE_FEE2, FEE_QUANTUM2, ",
        "DBCD2, REIMBURSEMENT_PAYMENT, ",
        "ENGLISH_NAME, ENGLISH_ADDR, ",
        "CASHLESS_PAYMENT, NEXTBILL_DATE, ",
        "NETWORK_CODE, CENTRE_CODE, ",
        "MEMBER_DBCD, MEMBER_CRCD, ",
        "VERIFY_OPDOC, CLAIMS_DBCD, ",
        "BILL_CARD_FEE, REIMBURSEMENT_PAYMENT_MODE, ",
        "INDUSTRY_TYPE, PAYBANKACCID, ",
        "APPLY_GST, APPLY_VAT, CURRCD, ",
        "PAYOR_CORP_CODE, INSERT_BY, ",
        "INSERT_DATE, PROVIDER_SERVICE_FEE_DBCD, ",
        "SELFPAID_COLLECTION)",
        "values (#{corpCode,jdbcType=VARCHAR}, #{shortName,jdbcType=OTHER}, ",
        "#{longName,jdbcType=OTHER}, #{address,jdbcType=OTHER}, #{postcode,jdbcType=VARCHAR}, ",
        "#{city,jdbcType=VARCHAR}, #{state,jdbcType=VARCHAR}, #{country,jdbcType=VARCHAR}, ",
        "#{telNo,jdbcType=VARCHAR}, #{faxNo,jdbcType=VARCHAR}, #{contactPerson,jdbcType=VARCHAR}, ",
        "#{corpType,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, ",
        "#{payorCode,jdbcType=CHAR}, #{ediAddress,jdbcType=VARCHAR}, ",
        "#{ediClaims,jdbcType=CHAR}, #{printChit,jdbcType=CHAR}, ",
        "#{commCode,jdbcType=VARCHAR}, #{invoiceFormat,jdbcType=DECIMAL}, ",
        "#{invoiceCycle,jdbcType=DECIMAL}, #{cutoffDate,jdbcType=TIMESTAMP}, ",
        "#{activeFlag,jdbcType=CHAR}, #{lasteditDate,jdbcType=TIMESTAMP}, ",
        "#{userCode,jdbcType=VARCHAR}, #{corpInvst,jdbcType=DECIMAL}, ",
        "#{corpUtilzP,jdbcType=DECIMAL}, #{corpDisUtilzP,jdbcType=DECIMAL}, ",
        "#{dbcd,jdbcType=VARCHAR}, #{renewalMode,jdbcType=CHAR}, ",
        "#{activationDate,jdbcType=TIMESTAMP}, #{cancellationDate,jdbcType=TIMESTAMP}, ",
        "#{serviceFee,jdbcType=DECIMAL}, #{cardFee,jdbcType=DECIMAL}, ",
        "#{feeQuantum,jdbcType=CHAR}, #{remarks,jdbcType=VARCHAR}, ",
        "#{serviceFee2,jdbcType=DECIMAL}, #{feeQuantum2,jdbcType=CHAR}, ",
        "#{dbcd2,jdbcType=VARCHAR}, #{reimbursementPayment,jdbcType=CHAR}, ",
        "#{englishName,jdbcType=VARCHAR}, #{englishAddr,jdbcType=VARCHAR}, ",
        "#{cashlessPayment,jdbcType=CHAR}, #{nextbillDate,jdbcType=TIMESTAMP}, ",
        "#{networkCode,jdbcType=VARCHAR}, #{centreCode,jdbcType=VARCHAR}, ",
        "#{memberDbcd,jdbcType=VARCHAR}, #{memberCrcd,jdbcType=VARCHAR}, ",
        "#{verifyOpdoc,jdbcType=CHAR}, #{claimsDbcd,jdbcType=VARCHAR}, ",
        "#{billCardFee,jdbcType=VARCHAR}, #{reimbursementPaymentMode,jdbcType=VARCHAR}, ",
        "#{industryType,jdbcType=VARCHAR}, #{paybankaccid,jdbcType=VARCHAR}, ",
        "#{applyGst,jdbcType=CHAR}, #{applyVat,jdbcType=CHAR}, #{currcd,jdbcType=VARCHAR}, ",
        "#{payorCorpCode,jdbcType=VARCHAR}, #{insertBy,jdbcType=VARCHAR}, ",
        "#{insertDate,jdbcType=TIMESTAMP}, #{providerServiceFeeDbcd,jdbcType=VARCHAR}, ",
        "#{selfpaidCollection,jdbcType=CHAR})"
    })
    int insert(Corporate record);

    int insertSelective(Corporate record);

    List<Corporate> selectByExample(CorporateExample example);

    @Select({
        "select",
        "CORP_CODE, SHORT_NAME, LONG_NAME, ADDRESS, POSTCODE, CITY, STATE, COUNTRY, TEL_NO, ",
        "FAX_NO, CONTACT_PERSON, CORP_TYPE, EMAIL, PAYOR_CODE, EDI_ADDRESS, EDI_CLAIMS, ",
        "PRINT_CHIT, COMM_CODE, INVOICE_FORMAT, INVOICE_CYCLE, CUTOFF_DATE, ACTIVE_FLAG, ",
        "LASTEDIT_DATE, USER_CODE, CORP_INVST, CORP_UTILZ_P, CORP_DIS_UTILZ_P, DBCD, ",
        "RENEWAL_MODE, ACTIVATION_DATE, CANCELLATION_DATE, SERVICE_FEE, CARD_FEE, FEE_QUANTUM, ",
        "REMARKS, SERVICE_FEE2, FEE_QUANTUM2, DBCD2, REIMBURSEMENT_PAYMENT, ENGLISH_NAME, ",
        "ENGLISH_ADDR, CASHLESS_PAYMENT, NEXTBILL_DATE, NETWORK_CODE, CENTRE_CODE, MEMBER_DBCD, ",
        "MEMBER_CRCD, VERIFY_OPDOC, CLAIMS_DBCD, BILL_CARD_FEE, REIMBURSEMENT_PAYMENT_MODE, ",
        "INDUSTRY_TYPE, PAYBANKACCID, APPLY_GST, APPLY_VAT, CURRCD, PAYOR_CORP_CODE, ",
        "INSERT_BY, INSERT_DATE, PROVIDER_SERVICE_FEE_DBCD, SELFPAID_COLLECTION",
        "from CORPORATE",
        "where CORP_CODE = #{corpCode,jdbcType=VARCHAR}"
    })
    @ResultMap("com.ssish.saas.eccs.mapper.CorporateMapper.BaseResultMap")
    Corporate selectByPrimaryKey(String corpCode);

    int updateByExampleSelective(@Param("record") Corporate record, @Param("example") CorporateExample example);

    int updateByExample(@Param("record") Corporate record, @Param("example") CorporateExample example);

    int updateByPrimaryKeySelective(Corporate record);

    @Update({
        "update CORPORATE",
        "set SHORT_NAME = #{shortName,jdbcType=OTHER},",
          "LONG_NAME = #{longName,jdbcType=OTHER},",
          "ADDRESS = #{address,jdbcType=OTHER},",
          "POSTCODE = #{postcode,jdbcType=VARCHAR},",
          "CITY = #{city,jdbcType=VARCHAR},",
          "STATE = #{state,jdbcType=VARCHAR},",
          "COUNTRY = #{country,jdbcType=VARCHAR},",
          "TEL_NO = #{telNo,jdbcType=VARCHAR},",
          "FAX_NO = #{faxNo,jdbcType=VARCHAR},",
          "CONTACT_PERSON = #{contactPerson,jdbcType=VARCHAR},",
          "CORP_TYPE = #{corpType,jdbcType=VARCHAR},",
          "EMAIL = #{email,jdbcType=VARCHAR},",
          "PAYOR_CODE = #{payorCode,jdbcType=CHAR},",
          "EDI_ADDRESS = #{ediAddress,jdbcType=VARCHAR},",
          "EDI_CLAIMS = #{ediClaims,jdbcType=CHAR},",
          "PRINT_CHIT = #{printChit,jdbcType=CHAR},",
          "COMM_CODE = #{commCode,jdbcType=VARCHAR},",
          "INVOICE_FORMAT = #{invoiceFormat,jdbcType=DECIMAL},",
          "INVOICE_CYCLE = #{invoiceCycle,jdbcType=DECIMAL},",
          "CUTOFF_DATE = #{cutoffDate,jdbcType=TIMESTAMP},",
          "ACTIVE_FLAG = #{activeFlag,jdbcType=CHAR},",
          "LASTEDIT_DATE = #{lasteditDate,jdbcType=TIMESTAMP},",
          "USER_CODE = #{userCode,jdbcType=VARCHAR},",
          "CORP_INVST = #{corpInvst,jdbcType=DECIMAL},",
          "CORP_UTILZ_P = #{corpUtilzP,jdbcType=DECIMAL},",
          "CORP_DIS_UTILZ_P = #{corpDisUtilzP,jdbcType=DECIMAL},",
          "DBCD = #{dbcd,jdbcType=VARCHAR},",
          "RENEWAL_MODE = #{renewalMode,jdbcType=CHAR},",
          "ACTIVATION_DATE = #{activationDate,jdbcType=TIMESTAMP},",
          "CANCELLATION_DATE = #{cancellationDate,jdbcType=TIMESTAMP},",
          "SERVICE_FEE = #{serviceFee,jdbcType=DECIMAL},",
          "CARD_FEE = #{cardFee,jdbcType=DECIMAL},",
          "FEE_QUANTUM = #{feeQuantum,jdbcType=CHAR},",
          "REMARKS = #{remarks,jdbcType=VARCHAR},",
          "SERVICE_FEE2 = #{serviceFee2,jdbcType=DECIMAL},",
          "FEE_QUANTUM2 = #{feeQuantum2,jdbcType=CHAR},",
          "DBCD2 = #{dbcd2,jdbcType=VARCHAR},",
          "REIMBURSEMENT_PAYMENT = #{reimbursementPayment,jdbcType=CHAR},",
          "ENGLISH_NAME = #{englishName,jdbcType=VARCHAR},",
          "ENGLISH_ADDR = #{englishAddr,jdbcType=VARCHAR},",
          "CASHLESS_PAYMENT = #{cashlessPayment,jdbcType=CHAR},",
          "NEXTBILL_DATE = #{nextbillDate,jdbcType=TIMESTAMP},",
          "NETWORK_CODE = #{networkCode,jdbcType=VARCHAR},",
          "CENTRE_CODE = #{centreCode,jdbcType=VARCHAR},",
          "MEMBER_DBCD = #{memberDbcd,jdbcType=VARCHAR},",
          "MEMBER_CRCD = #{memberCrcd,jdbcType=VARCHAR},",
          "VERIFY_OPDOC = #{verifyOpdoc,jdbcType=CHAR},",
          "CLAIMS_DBCD = #{claimsDbcd,jdbcType=VARCHAR},",
          "BILL_CARD_FEE = #{billCardFee,jdbcType=VARCHAR},",
          "REIMBURSEMENT_PAYMENT_MODE = #{reimbursementPaymentMode,jdbcType=VARCHAR},",
          "INDUSTRY_TYPE = #{industryType,jdbcType=VARCHAR},",
          "PAYBANKACCID = #{paybankaccid,jdbcType=VARCHAR},",
          "APPLY_GST = #{applyGst,jdbcType=CHAR},",
          "APPLY_VAT = #{applyVat,jdbcType=CHAR},",
          "CURRCD = #{currcd,jdbcType=VARCHAR},",
          "PAYOR_CORP_CODE = #{payorCorpCode,jdbcType=VARCHAR},",
          "INSERT_BY = #{insertBy,jdbcType=VARCHAR},",
          "INSERT_DATE = #{insertDate,jdbcType=TIMESTAMP},",
          "PROVIDER_SERVICE_FEE_DBCD = #{providerServiceFeeDbcd,jdbcType=VARCHAR},",
          "SELFPAID_COLLECTION = #{selfpaidCollection,jdbcType=CHAR}",
        "where CORP_CODE = #{corpCode,jdbcType=VARCHAR}"
    })
    int updateByPrimaryKey(Corporate record);
}